<template>
	<view class="content">
		<image class="logo" style="width: 500rpx;height: 500rpx;"
			src="https://mp-a65e6a28-9384-49da-a1e2-e026c9b9d285.cdn.bspapp.com/system/谁有.gif"></image>
		<view class="text-area">
			<text class="title">{{title}}</text>
			<view class="btn" @click="logwithpwd">点我登录</view>
		</view>
	</view>
</template>

<script>
	const userApi = uniCloud.importObject('user')
	import {
		mapState,
		mapGetters,
		mapActions
	} from 'vuex'
	export default {
		data() {
			return {
				title: '谁有'
			}
		},
		onLoad() {
			var self = this
			uni.$on("uni-id-pages-login-success", self.onLogin)

		},
		methods: {
			logwithpwd: function() {
				uni.navigateTo({
					"url": "/uni_modules/uni-id-pages/pages/login/login-withpwd"
				})

			},
			...mapActions(['fetchUser']),
			async onLogin() {
				const token = uni.getStorageSync("uni_id_token")
				const res=await this.fetchUser(token)
			}
		},
		}
</script>

<style>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.logo {
		height: 200rpx;
		width: 200rpx;
		margin-top: 200rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
	}

	.text-area {
		display: flex;
		flex-direction: column;
		justify-content: center;
		text-align: center;
	}

	.title {
		font-size: 36rpx;
		color: #8f8f94;
	}

	.btn {
		margin-top: 30px;
		border-radius: 10px;
		padding: 5px 30px;
		border: #8f8f94 1px solid;
		font-weight: bold;
		background-color: antiquewhite;
	}
</style>